package com.succodes.lostandfound.service;

import com.succodes.lostandfound.entity.User;
import com.succodes.lostandfound.security.JwtUser;
import com.succodes.lostandfound.security.ResponseUserToken;

/**
 * @author: JoeTao
 * createAt: 2018/9/17
 */
public interface AuthService {

    /**
     * 注册
     * @param jwtUser
     * @return User
     */
    User register(User jwtUser);

    /**
     * 登录
     * @param username password
     * @return ResponseUserToken
     */
    ResponseUserToken login(String username, String password);

    /**
     * 登出
     * @param token
     * @return void
     */
    void logout(String token);

    /**
     * 刷新Token
     * @param oldToken
     * @return ResponseUserToken
     */
    ResponseUserToken refresh(String oldToken);

    /**
     * 根据Token获取用户信息
     * @param token
     * @return JwtUser
     */
    JwtUser getUserByToken(String token);
}
